<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <ui:composition template="../TemplateAdmin.xhtml">
        <ui:define name="title">
            <h:outputText value="Add Elevation"></h:outputText>
        </ui:define>       
        <ui:define name="body">
            <h:form>
                <p:panel>
                    <p:panelGrid columns="3" >
                        <!-- tiêu đề -->
                        <f:facet name="header">
                            <b>Create  Elevation</b>
                        </f:facet>
                        <!-- name -->
                        <h:outputLabel value="Name :" for="elName" />  
                        <p:inputText id="elName" value="#{elevationController.selected.elName}" title="Name"
                                     required="true" requiredMessage="The Name field is required"  />
                        <p:message id="etNameMessage" for="elName" display="text"/> 

                        <h:outputLabel value="Type :" for="etID" />  
                        <p:selectOneMenu value="#{elevationController.selected.etID}" id="etID">   
                            <f:selectItems value="#{elevationTypeController.itemsAvailableSelectOne}"/>
                        </p:selectOneMenu>
                        <h:panelGroup/>

                        <h:outputLabel value="Cost : "  for="elCost"/>  
                        <p:inputText id="elCost" value="#{elevationController.selected.elCost}"
                                     title="Cost" required="true" requiredMessage="The Cost field is required"  />
                        <p:message id="etCostMessage" for="elCost" display="text"/>  

                        <h:outputLabel value="Description : " for="elDescription" /> 
                        <p:inputTextarea value="#{elevationController.selected.elDescription}" id="elDescription" 
                                         title="Description" required="true" requiredMessage="The Description field is required"/>           
                        <p:message id="elDescriptionMessage" for="elDescription" display="text"/> 

                        <h:outputLabel value="Image(URL): " for="elImage" /> 
                        <p:inputText value="#{elevationController.selected.elImage}" id="elImage" title="Image"/>     
                        <h:panelGroup/>

                        <h:outputLabel value="Status : " for="elStatus" /> 
                        <p:selectOneRadio value="#{elevationController.selected.elStatus}" id="elStatus">  
                            <f:selectItem itemLabel="Active" itemValue="1" />  
                            <f:selectItem itemLabel="Disable" itemValue="0" /> 
                        </p:selectOneRadio>

                        <h:panelGroup/>
                    </p:panelGrid>

                    <p:commandButton action="#{elevationController.create}" value="Save" icon="ui-icon-check" />
                    <p:commandButton action="#{elevationController.prepareList}" value="View All" icon="ui-icon-script" immediate="true" />
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

